package dao;

import java.lang.reflect.Method;

import Manager.ManageConnection;



public abstract class DAO {

	public ManageConnection getManageConnection() {
		return ManageConnection.getInstance();
	}
	
	public abstract boolean insert(Object o);
	
	public abstract boolean update(Object o);
	
	public abstract boolean delete(int id);
	
	protected void printBean (Object o) throws Exception{
		Method methodsList[] = o.getClass().getMethods();
		
		for(int i=0;i<methodsList.length;i++){
			
			String methodName = methodsList[i].getName().substring(3);
			
			if(methodsList[i].getName().startsWith("get") && !(methodsList[i].getName().startsWith("getClass")))
				System.out.println(methodName + " = " + methodsList[i].invoke(o));
		
		}
	}

	public abstract Object findById(Object id);	

}
